import { DeviceManager } from './utils/util'
App({
  globalData: {
    user: wx.getStorageSync('user') || {},
    token: wx.getStorageSync('token') || '',
    refreshToken: wx.getStorageSync('refreshToken') || '',
    privacyAgreed: false,
    deviceId: wx.getStorageSync('device_id') || ''
  },

  async onLaunch() {
    this.globalData.deviceId = await DeviceManager.getDeviceId()
  },
  showLoading() {
    wx.showLoading()
  },
  hideLoading() {
    wx.hideLoading()
  },
  
  showToast(title, icon) {
    wx.showToast({
      title: title || '',
      icon: icon || 'none',
      duration: 3000,
      mask: true,
      success: function (res) {},
      fail: function (res) {},
      complete: function (res) {}
    })
  }
})